package cn.com.bluemoon.job;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;

import java.util.Date;

/**
 * Created by mijun on 2017/8/25.
 */
public class MyElasticJob implements SimpleJob {

    @Override
    public void execute(ShardingContext shardingContext) {
//        System.out.println("-------------------------------"+shardingContext.getShardingItem()+":"+new Date().toLocaleString());
        switch (shardingContext.getShardingItem()) {
            case 0:
                System.out.println("0000000000000--------"+shardingContext.getShardingItem()+":"+new Date().toLocaleString());
                break;
            case 1:
                System.out.println("1111111111111--------"+shardingContext.getShardingItem()+":"+new Date().toLocaleString());

                break;
            case 2:
                System.out.println("2222222222222--------"+shardingContext.getShardingItem()+":"+new Date().toLocaleString());
                break;
            // case n: ...
        }
    }
}
